package com.exception.demo.controller;

import com.exception.demo.exception.MyException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName HelloController
 * @description: TODO
 * @author: 朱同学
 * @Date 2021/4/9 21:46
 **/
@Controller
public class HelloController {

    @GetMapping("index")
    public String hello() throws Exception {
        throw new Exception("系统出现异常！");
        //return "index";
    }

    @ResponseBody
    @GetMapping("hello")
    public String hello2() throws MyException {
        throw new MyException("系统出现异常！");
        //return "hello";
    }
}
